﻿@page "/TableDemo"

<Table TItem="Food" ShowRefresh="true" ShowSkeleton="true"
       IsStriped="true" IsBordered="true" ShowDefaultButtons="true" ShowAddButton="true" ShowDeleteButton="false" ShowEditButton="true" IsExtendButtonsInRowHeader="true"
       ShowToolbar="true" ShowSearch="true" ShowAdvancedSearch="true" ShowExtendButtons="true" ShowExtendDeleteButton="true" ShowExtendEditButton="true"
       OnQueryAsync="@OnQueryAsync" OnSaveAsync="@OnSaveAsync" OnDeleteAsync="@OnDeleteAsync"
       ExtendButtonColumnWidth="150" ClickToSelect="true" ShowFooter="true" DisableAutoSubmitFormByEnter="true">
    <TableColumns>
        <TableColumn @bind-Field="@context.Name" Readonly Filterable="true" Align="Alignment.Center" Searchable="true" />
        <TableColumn @bind-Field="@context.Age" Align="Alignment.Center" Searchable="true" />
    </TableColumns>
    <EditTemplate>
        @*包在组件里也试过，OnEnterAsync无法获取到输入的值，IsAutoFocus在弹窗中也失效。*@
        <div class="row g-3 form-inline">
            <div class="my-1 col-12 col-sm-6">
                <BootstrapInput TValue="string" placeholder="请输入单号" DisplayText="单号" maxlength="50" ShowLabel="true" IsAutoFocus="true" OnEnterAsync="OnEnterAsync">
                </BootstrapInput>
            </div>
        </div>
    </EditTemplate>
</Table>
